<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>微服务架构核心指南</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            min-height: 100vh;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        .card-hover {
            transition: all 0.3s ease;
        }
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 40px rgba(0,0,0,0.1);
        }
        .text-gradient {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }
        .component-card {
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(10px);
        }
        .advantage-icon {
            background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
        }
        .disadvantage-icon {
            background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
        }
        .mermaid {
            background: white;
            border-radius: 12px;
            padding: 20px;
        }
        .drop-cap {
            float: left;
            font-size: 4rem;
            line-height: 3rem;
            padding-right: 0.5rem;
            margin-top: 0.5rem;
            font-weight: 700;
            color: #667eea;
        }
    </style>
</head>
<body>
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20 px-6">
        <div class="max-w-6xl mx-auto text-center">
            <h1 class="text-5xl md:text-6xl font-bold mb-6 tracking-tight">
                微服务架构核心指南
            </h1>
            <p class="text-xl md:text-2xl mb-8 opacity-90 max-w-3xl mx-auto leading-relaxed">
                深入理解微服务的核心组件与优劣势，掌握现代分布式系统的设计精髓
            </p>
            <div class="flex justify-center space-x-8 text-lg">
                <div class="flex items-center">
                    <i class="fas fa-cubes mr-2"></i>
                    <span>10大核心组件</span>
                </div>
                <div class="flex items-center">
                    <i class="fas fa-balance-scale mr-2"></i>
                    <span>全面优劣分析</span>
                </div>
                <div class="flex items-center">
                    <i class="fas fa-chart-network mr-2"></i>
                    <span>架构可视化</span>
                </div>
            </div>
        </div>
    </section>

    <!-- Introduction Section -->
    <section class="py-16 px-6">
        <div class="max-w-4xl mx-auto bg-white rounded-2xl shadow-xl p-10">
            <p class="text-lg leading-relaxed text-gray-700">
                <span class="drop-cap">在</span>微服务架构中，<strong class="text-gradient">核心组件</strong>和<strong class="text-gradient">优劣势</strong>是理解和实现微服务成功的关键因素。它也带来了分布式系统的复杂性和管理挑战。在实施微服务架构时，需要综合考虑其优缺点，并根据项目需求和技术栈选择合适的技术解决方案。
            </p>
        </div>
    </section>

    <!-- Architecture Visualization -->
    <section class="py-16 px-6 bg-gray-50">
        <div class="max-w-7xl mx-auto">
            <h2 class="text-4xl font-bold text-center mb-12 text-gray-800">微服务架构全景图</h2>
            <div class="mermaid">
                graph TB
                    subgraph "外部请求"
                        Client[客户端]
                    end
                    
                    subgraph "边缘层"
                        Gateway[API网关<br/>路由/认证/限流]
                    end
                    
                    subgraph "服务层"
                        MS1[微服务1]
                        MS2[微服务2]
                        MS3[微服务3]
                        MS4[微服务N]
                    end
                    
                    subgraph "支撑组件"
                        SD[服务发现<br/>Eureka/Consul]
                        Config[配置中心<br/>Spring Config]
                        MQ[消息队列<br/>Kafka/RabbitMQ]
                        CB[断路器<br/>Hystrix]
                    end
                    
                    subgraph "数据层"
                        DB1[(数据库1)]
                        DB2[(数据库2)]
                        Cache[(缓存Redis)]
                    end
                    
                    subgraph "监控层"
                        Monitor[监控系统<br/>Prometheus]
                        Trace[链路追踪<br/>Zipkin]
                        Log[日志系统<br/>ELK]
                    end
                    
                    Client --> Gateway
                    Gateway --> MS1
                    Gateway --> MS2
                    Gateway --> MS3
                    Gateway --> MS4
                    
                    MS1 -.-> SD
                    MS2 -.-> SD
                    MS3 -.-> SD
                    MS4 -.-> SD
                    
                    MS1 --> DB1
                    MS2 --> DB2
                    MS3 --> Cache
                    MS4 --> Cache
                    
                    MS1 -.-> Config
                    MS2 -.-> Config
                    MS1 --> MQ
                    MS2 --> MQ
                    MS1 -.-> CB
                    
                    MS1 -.-> Monitor
                    MS2 -.-> Monitor
                    MS1 -.-> Trace
                    MS2 -.-> Trace
                    MS1 -.-> Log
                    MS2 -.-> Log
                    
                    style Client fill:#f9f,stroke:#333,stroke-width:2px
                    style Gateway fill:#bbf,stroke:#333,stroke-width:2px
                    style SD fill:#bfb,stroke:#333,stroke-width:2px
                    style Config fill:#bfb,stroke:#333,stroke-width:2px
                    style MQ fill:#fbf,stroke:#333,stroke-width:2px
                    style CB fill:#ffb,stroke:#333,stroke-width:2px
            </div>
        </div>
    </section>

    <!-- Core Components Section -->
    <section class="py-16 px-6">
        <div class="max-w-7xl mx-auto">
            <h2 class="text-4xl font-bold text-center mb-4 text-gray-800">微服务核心组件</h2>
            <p class="text-center text-gray-600 mb-12 text-lg">构建可靠微服务架构的十大基石</p>
            
            <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                <!-- Component 1 -->
                <div class="component-card card-hover rounded-xl p-6 border border-gray-100">
                    <div class="flex items-start">
                        <div class="bg-purple-100 rounded-lg p-3 mr-4">
                            <i class="fas fa-search-location text-2xl text-purple-600"></i>
                        </div>
                        <div class="flex-1">
                            <h3 class="text-xl font-bold mb-2 text-gray-800">服务发现（Service Discovery）</h3>
                            <p class="text-gray-600 mb-3">自动注册和发现服务实例，动态地管理服务的地址和状态。</p>
                            <div class="flex flex-wrap gap-2 mb-3">
                                <span class="px-3 py-1 bg-purple-50 text-purple-700 rounded-full text-sm">Eureka</span>
                                <span class="px-3 py-1 bg-purple-50 text-purple-700 rounded-full text-sm">Consul</span>
                                <span class="px-3 py-1 bg-purple-50 text-purple-700 rounded-full text-sm">Nacos</span>
                            </div>
                            <p class="text-sm text-gray-500"><i class="fas fa-info-circle mr-1"></i>服务实例启动时注册，其他服务通过发现系统查找调用目标</p>
                        </div>
                    </div>
                </div>

                <!-- Component 2 -->
                <div class="component-card card-hover rounded-xl p-6 border border-gray-100">
                    <div class="flex items-start">
                        <div class="bg-blue-100 rounded-lg p-3 mr-4">
                            <i class="fas fa-balance-scale-right text-2xl text-blue-600"></i>
                        </div>
                        <div class="flex-1">
                            <h3 class="text-xl font-bold mb-2 text-gray-800">负载均衡（Load Balancing）</h3>
                            <p class="text-gray-600 mb-3">分发请求到多个服务实例，确保负载均匀，提高系统可用性。</p>
                            <div class="flex flex-wrap gap-2 mb-3">
                                <span class="px-3 py-1 bg-blue-50 text-blue-700 rounded-full text-sm">Ribbon</span>
                                <span class="px-3 py-1 bg-blue-50 text-blue-700 rounded-full text-sm">Nginx</span>
                                <span class="px-3 py-1 bg-blue-50 text-blue-700 rounded-full text-sm">Spring Gateway</span>
                            </div>
                            <p class="text-sm text-gray-500"><i class="fas fa-info-circle mr-1"></i>支持轮询、加权、最少连接等多种负载策略</p>
                        </div>
                    </div>
                </div>

                <!-- Component 3 -->
                <div class="component-card card-hover rounded-xl p-6 border border-gray-100">
                    <div class="flex items-start">
                        <div class="bg-green-100 rounded-lg p-3 mr-4">
                            <i class="fas fa-door-open text-2xl text-green-600"></i>
                        </div>
                        <div class="flex-1">
                            <h3 class="text-xl font-bold mb-2 text-gray-800">服务网关（API Gateway）</h3>
                            <p class="text-gray-600 mb-3">统一处理外部请求，提供路由、安全、监控等功能。</p>
                            <div class="flex flex-wrap gap-2 mb-3">
                                <span class="px-3 py-1 bg-green-50 text-green-700 rounded-full text-sm">Zuul</span>
                                <span class="px-3 py-1 bg-green-50 text-green-700 rounded-full text-sm">Kong</span>
                                <span class="px-3 py-1 bg-green-50 text-green-700 rounded-full text-sm">Gateway</span>
                            </div>
                            <p class="text-sm text-gray-500"><i class="fas fa-info-circle mr-1"></i>处理认证、授权、限流等跨切面功能</p>
                        </div>
                    </div>
                </div>

                <!-- Component 4 -->
                <div class="component-card card-hover rounded-xl p-6 border border-gray-100">
                    <div class="flex items-start">
                        <div class="bg-yellow-100 rounded-lg p-3 mr-4">
                            <i class="fas fa-cogs text-2xl text-yellow-600"></i>
                        </div>
                        <div class="flex-1">
                            <h3 class="text-xl font-bold mb-2 text-gray-800">配置管理（Configuration Management）</h3>
                            <p class="text-gray-600 mb-3">集中管理和动态配置微服务的配置信息。</p>
                            <div class="flex flex-wrap gap-2 mb-3">
                                <span class="px-3 py-1 bg-yellow-50 text-yellow-700 rounded-full text-sm">Spring Config</span>
                                <span class="px-3 py-1 bg-yellow-50 text-yellow-700 rounded-full text-sm">Consul</span>
                                <span class="px-3 py-1 bg-yellow-50 text-yellow-700 rounded-full text-sm">Nacos</span>
                            </div>
                            <p class="text-sm text-gray-500"><i class="fas fa-info-circle mr-1"></i>支持配置热更新，无需重启服务</p>
                        </div>
                    </div>
                </div>

                <!-- Component 5 -->
                <div class="component-card card-hover rounded-xl p-6 border border-gray-100">
                    <div class="flex items-start">
                        <div class="bg-red-100 rounded-lg p-3 mr-4">
                            <i class="fas fa-route text-2xl text-red-600"></i>
                        </div>
                        <div class="flex-1">
                            <h3 class="text-xl font-bold mb-2 text-gray-800">分布式追踪（Distributed Tracing）</h3>
                            <p class="text-gray-600 mb-3">跟踪请